<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML >
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6 lt8"> <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7 lt8"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8 lt8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
  <head>
    <base href="<%=basePath%>">
        <meta charset="UTF-8" />
        <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  -->
        <title>视盾科技</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
        <meta name="description" content="Login and Registration Form with HTML5 and CSS3" />
        <meta name="keywords" content="html5, css3, form, switch, animation, :target, pseudo-class" />
        <meta name="author" content="Codrops" />
 <link rel="shortcut icon" href="images/font/logo.jpg" type="image/x-icon" />
        <link rel="stylesheet" type="text/css" href="css/login/demo.css" /> 
        <link rel="stylesheet" type="text/css" href="css/login/style.css" /> 
		<link rel="stylesheet" type="text/css" href="css/login/animate-custom.css" /> 
		<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />   
		<link rel="stylesheet" type="text/css" href="css/common.css" />   
    </head>
    <body onkeypress="if (event.keyCode == 13) login();">
        <div class="container">
            <!-- Codrops top bar -->
           
            <header>
                <h1>北京 <span>视盾科技发展</span>有限公司</h1>
				<nav class="codrops-demos">
					<span>专注驾考 </span>
				</nav>
            </header>
            <section>				
                <div id="container_demo" >
                    <!-- hidden anchor to stop jump http://www.css3create.com/Astuce-Empecher-le-scroll-avec-l-utilisation-de-target#wrap4  -->
                    <a class="hiddenanchor" id="toregister"></a>
                    <a class="hiddenanchor" id="tologin"></a>
                    <div id="wrapper">
                        <div id="login" class="animate form">
                            <form  action="mysuperscript.php" autocomplete="on"> 
                                <h1>Log in</h1> 
								<span id="errmsg" class="alert alert-block" style="margin-left:150px;text-align:center;align:center;color:red;font-size:14px;">&nbsp;</span>
                                <p> 
                                    <label for="username" class="uname" data-icon="u" > Your account </label>
                                    <input id="account" name="account" required="required" type="text" placeholder="your account"/>
                                </p>
                                <p> 
                                    <label for="password" class="youpasswd" data-icon="p"> Your password </label>
                                    <input id="pwd" name="pwd" required="required" type="password" placeholder="your password" /> 
                                </p>
                                <p class="keeplogin"> 
									<!-- <input type="checkbox" name="loginkeeping" id="loginkeeping" value="loginkeeping" /> 
									<label for="loginkeeping">Keep me logged in</label> -->
								</p>
                                <p class="login button"> 
                                    <a class="btn" href="javascript:login()" style="background-color:#7cbcd6;width:102%;height:50px;margin:0 auto;font-size:24px;color:#000;">登录</a>
								</p>
                                <p class="change_link">
									视盾科技
								</p>
                            </form>
                        </div>
						
                    </div>
                </div>  
            </section>
        </div>
        
        
        <script type="text/javascript" src="js/jquery.min.js"></script>
        <script type="text/javascript" src="js/resources/jquery.md5.js"></script>
        <script type="text/javascript">
        	var path='<%=basePath%>';
        	$(function(){
        		var h=window.parent.parent.location.href;
        		if(h.indexOf(".jsp")<=0){
        			window.parent.parent.location.href=path+"login.jsp";
        		}
        	});
        	
        	function login(){
        		if(valid()){
        			$.post("adminUserAction_login.action",{
        				"account":$("#account").val(),
        				"pwd":$.md5($("#pwd").val())
        			},function(res){
        				res=eval('(' + res + ')');
        				if(res.rescode=='100'){
        					/* $.post("adminUserAction_getRoles.action",function(roles){
            					alert(roles); 
            					console.log(roles);
            					for(var i=0;i<roles.length;i++){
            						alert(roles[i]);
            					}
            				}); */ 
            				window.location.href="pages/manage/main.html";
        				}else{
        					$("#errmsg").text(res.msg);
        				}
        				
        			});
        		}
        	}
        	
        	function valid(){
        		if(!$("#account").val()){
        			$("#errmsg").text("用户名不能为空");
        			/* $("#account").css("border","1px solid red"); */
        			$("#account").focus();
        			return false;
        		}
        		if(!$("#pwd").val()){
        			$("#errmsg").text("密码不能为空");
        			/* $("#pwd").css("border","1px solid red"); */
        			$("#pwd").focus();
        			return false;
        		}
        		return true;
        	}
        </script>
        
    </body>
</html>